/**
 * Created by xiaolinzhang on 2016/11/1.
 */


var Bookshelf = null;
var mysqlcon = require('../conf/config')['mysql'];



module.exports = function () {
    if(Bookshelf){
        return Bookshelf;
    }

    var knex = require('knex')(mysqlcon);
    Bookshelf = require('bookshelf')(knex);

    Bookshelf.plugin('registry');

    return Bookshelf;
}